package com.pig4cloud.pigx.contract.executer.order.initializer;

import com.pig4cloud.pigx.contract.bo.ContractOrderNewBO;
import com.pig4cloud.pigx.contract.vo.ContractOrderInitResVO;

/**
 * 订单初始化器
 *
 * @since 2022/8/17 10:55
 */
public interface OrderInitializer {

    /**
     * 判断是否支持
     *
     * @param bo 入参
     * @return {@link boolean}
     * @since 2022/8/17 11:20
     */
    boolean support(ContractOrderNewBO bo);

    /**
     * 初始化订单
     *
     * @param bo 入参
     * @since 2022/8/17 11:15
     */
    void init(ContractOrderNewBO bo);

    /**
     * 初始化成功
     *
     * @param bo 入参
     * @return {@link ContractOrderInitResVO}
     * @since 2022/8/17 11:31
     */
    ContractOrderInitResVO success(ContractOrderNewBO bo);

    /**
     * 初始化失败
     *
     * @param bo 入参
     * @param e  异常
     * @since 2022/8/17 11:31
     */
    void fail(ContractOrderNewBO bo, Exception e);
}
